<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">
		<h:form id="something">
			<div align="center">
				<h:dataTable value="#{loanBean.loanList}" var="lo" bgcolor="#F1F1F1"
					border="2" width="90%">
					<h:column>
						<f:facet name="header">
							<h:outputText value="Autor" />
						</f:facet>
						<h:outputText value="#{lo.book.author}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Tytuł" />
						</f:facet>
						<h:outputText value="#{lo.book.title}" />
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Właściciel" />
						</f:facet>
						<h:outputText value="#{lo.user.name}" />
					</h:column>

					<h:column>
						<h:commandButton value="Zwróć" action="#{loanBean.redirect}" >
						<f:setPropertyActionListener target="#{loanBean.selectedItem}" value="#{lo}" />
						
						</h:commandButton>
					</h:column>

				</h:dataTable>
			</div>
		</h:form>
	</ui:define>

</ui:composition>
</html>